package com.entor.controller;

import com.entor.model.Pupil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import com.entor.util.Json;
import com.entor.sevice.PupilServiceI;


/**
 * @author HQJ
 * @date 2017年10月27日
 */

@RequestMapping("/pupil")
@Controller
public class PupilController extends BaseController<Pupil> {


 @Autowired
 private PupilServiceI service;
  
 
 public List<Pupil> find(Pupil pupil){
  List<Pupil> list = service.find(pupil);
  return list;
 }
 public String insert(Pupil pupil){
  int i = service.insert(pupil);
  if(i>0){
	  return "info/findPupil";
  }else return "error/500";
	  
 }
 public Json update(Pupil pupil){
  int i = service.update(pupil);
  return this.getJson(i, "更新");
 }
 public Json delete(HttpServletRequest request){
  String id = request.getParameter("id");
  int i = service.delete(id);
  return this.getJson(i, "删除");
 }

}